<?php
include('init.php');
function parseImage() {
    $im = imagecreate($width, $height);
	$back = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
	$fore = imagecolorallocate($im, 57, 231, 249);
	imagechar($img,$font_size,$xpos,$ypos,$string,$black);
}
function checkCookie($key){
	if (is_null($_COOKIE[$key])) {
		die('parameter lost');
	} else {
		return $_COOKIE[$key];
	}
}
$time1 = checkCookie('user_token_time');
$time2 = substr($_SERVER['REQUEST_TIME_FLOAT'], 8);
$spend = floor(($time2 - $time1) * 10000);
$id = checkCookie('user_token_id');
$dbh->exec("UPDATE user_track SET spend_time=$spend WHERE track_id=$id");
parseImage("A");